import { defHttp } from '/@/utils/http/axios';
import {  WebsiteTrainingScheduleModel, WebsiteTrainingScheduleTableRecordModel } from '../model/websiteTrainingScheduleModel';
import { ErrorMessageMode } from "/#/axios";

enum Api {
  WEBSITETRAININGSCHEDULE_PAGE = '/jxxhWebsite/websiteTrainingSchedule/getTrainingScheduleVosPage',
  GET_WEBSITETRAININGSCHEDULEVO_BY_ID = '/jxxhWebsite/websiteTrainingSchedule/',
  WEBSITETRAININGSCHEDULEVO_SAVE = '/jxxhWebsite/websiteTrainingSchedule/save',
  WEBSITETRAININGSCHEDULEVO_UPDATE = '/jxxhWebsite/websiteTrainingSchedule/updateById',
  WEBSITETRAININGSCHEDULEVO_REMOVE = '/jxxhWebsite/websiteTrainingSchedule/logicalRemoveById/',
}

/**
 * @description: Get sample list value
 */

export const websiteTrainingScheduleListApi = (params: Object) =>
  defHttp.get<WebsiteTrainingScheduleTableRecordModel>(
    {url: Api.WEBSITETRAININGSCHEDULE_PAGE,params },
    { errorMessageMode: 'message' }
  );

export const getWebsiteTrainingScheduleVoByIdApi = (id) =>
  defHttp.get<WebsiteTrainingScheduleModel>(
    {url: Api.GET_WEBSITETRAININGSCHEDULEVO_BY_ID+id },
    { errorMessageMode: 'message' }
  );

export function websiteTrainingScheduleSaveApi(params: WebsiteTrainingScheduleModel, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<WebsiteTrainingScheduleModel>(
    {
      url: Api.WEBSITETRAININGSCHEDULEVO_SAVE,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}
export function websiteTrainingScheduleUpdateApi(params: WebsiteTrainingScheduleModel, mode: ErrorMessageMode = 'modal') {
  return defHttp.put<WebsiteTrainingScheduleModel>(
    {
      url: Api.WEBSITETRAININGSCHEDULEVO_UPDATE,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}
export const logicalRemoveById = (id) =>
  defHttp.delete<WebsiteTrainingScheduleModel>(
    {url: Api.WEBSITETRAININGSCHEDULEVO_REMOVE+id },
    { errorMessageMode: 'message' }
  );
